<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>
<!--公共部分-->
    
        <link href="/static/school/css/layout.css" type="text/css" rel="stylesheet" />
    <script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
    <!--私有部分-->
    <link href="/static/school/css/frame.style.css" type="text/css" rel="stylesheet" />

    <link href="/static/school/css/default.style.css" type="text/css" rel="stylesheet" />
    <link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
    <script src="/static/public/layer/src/layui.js"></script>
    <script src="/static/school/js/default.common.js" type="text/javascript"></script>
	<script type="text/javascript">
		var dire = 'user';
		var thumb = 'big_thumb,middle_thumb,small_thumb';
		var fileNumLimit = 6;
	</script>
					<div class="mainScroll">
					<div class="mainContainer line-all">
						<ul class="ui-nav-tab wList33">
							<li class="js-step-1 active"><a href="javascript:;">1.编辑课程基本信息</a></li>
							<li class="js-step-2"><a href="javascript:;">2.编辑课程目录</a></li>
						</ul>
						<div class="tabMainCont">
							<!--star 编辑课程基本信息-->
							<div class="tabItem step-01">
								<input type="hidden" id="token" value="<{$token}>">
								<form class="layui-form" method="post" action="<{$post_url}>">
								<div class="line-all p20">
										<input type="hidden" name="id" value="<{$course['id']|default:'0'}>" />
										<div class="layui-form-item">
											<label class="layui-form-label">课程分类：</label>
											<div class="layui-input-inline">
												<select name="cate_id" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
													<option value="">课程分类</option>
													<{foreach from=$cate item=item}>

														<option value="<{$item.id}>" <{if $course['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
													<{/foreach}>
												</select>
											</div>
											<div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">课程科目：</label>
											<div class="layui-input-inline">
												<select name="subject_id" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
													<option value="">请选择科目</option>
													<{if isset($cate_subject) AND $cate_subject|count > 0}>
													<{foreach from=$cate_subject item=cate_sub}>
													<option value="<{$cate_sub.id}>" <{if $course.subject_id == $cate_sub.id}>selected<{/if}>><{$cate_sub.name}></option>
													<{/foreach}>
													<{/if}>
												</select>
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">主讲老师：</label>
											<div class="layui-input-inline">
												<input type="text" value="<{$course['teacher_name']|default:""}>" name="teacher_name" placeholder="主讲老师" required lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;">
											</div>
											<!-- <div class="layui-form-mid layui-word-aux">从学校老师中选择，为添加老师请先添加，　<a href="/teacher/teacher_add"  class="c-52a1fa">添加老师</a></div> -->
										</div>
										<div class="layui-form-item">
											<div class="layui-inline">
												<label class="layui-form-label">课程名称：</label>
												<div class="layui-input-block">
													<input type="text" value="<{$course['title']|default:""}>" name="title" placeholder="课程名称" required lay-verify="required" autocomplete="off" class="layui-input" style="width: 800px;">
												</div>
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
											<label class="layui-form-label">封面图</label>
											<div class="layui-input-block" style="margin-top: 5px;">
												<div id="uploader2" class="upload_box" style="float:left; width:420px;">
													<div class="queueList">
														<div id="dndArea2" class="placeholder dndArea">
															<div id="filePicker2" class="filePicker"></div>
															<p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
														</div>
													</div>
													<div class="statusBar" style="display:none;">
														<div class="progress">
															<span class="text">0%</span>
															<span class="percentage"></span>
														</div><div class="info"></div>
														<div class="btns">
															<div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
														</div>
													</div>
													<div class="upload_img_input" input_name='img_url[]'></div>
												</div>
												<{if isset($course['course_img']) AND $course['course_img'] != ''}>
													<div class="layui-inline" style="float:left;"><img src="<{$course['course_img']}>" style="max-height:175px;"/></div>
												<{/if}>
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
											<label class="layui-form-label">试看视频</label>
											<div class="layui-input-block" style="padding-top: 10px;">
												
												<a href="javascript:;" class="add_video" onclick="sel_video(this)">+选择视频</a>
												<div class="sel_video">
													<p><{$video_title|default:''}></p><input type="hidden" class="selected" name="vid" value="<{$course.vid|default:0}>">
												</div>
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">课时:</label>
											<div class="layui-input-inline">
												<input type="number" lay-verify="number" value="<{$course['course_time']|default:""}>" placeholder="请输入课时" name="course_time"  autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">课时</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">价格:</label>
											<div class="layui-input-inline">
												<input type="text" value="<{$course['price']|default:""}>" placeholder="请输入价格" name="price" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">元</div>
										</div>
										<!-- <div class="layui-form-item">
											<label class="layui-form-label">有效期:</label>
											<div class="layui-input-inline">
												<input type="number" lay-verify="number" value="<{$course['effective_time']|default:""}>" placeholder="请输入有效期" name="effective_time" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
											<div class="layui-form-mid layui-word-aux">天</div>
										</div> -->
										<div class="layui-form-item">
											<label class="layui-form-label">学到什么:</label>
											<div class="layui-input-block">
												<input type="text" value="<{$course['learn_what']|default:""}>" placeholder="请输入学到什么" name="learn_what" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">适合人群:</label>
											<div class="layui-input-block">
												<input type="text" value="<{$course['suitable']|default:""}>" placeholder="请输入适合人群" name="suitable" lay-verify="required" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-form-item layui-form-text">
											<label class="layui-form-label">课程详情：</label>
											<div class="layui-input-block">
													<textarea name="detail" id="detail" placeholder="请输入详情" class="layui-textarea editor"><{$course.detail|default:''}></textarea>
											</div>
										</div>


										<div class="p-tb30 tac">
											<button class="layui-btn layui-btn-normal" lay-submit lay-filter="*">发布课程并编辑科目</button>
										</div>
								</div>


							</form>

							</div>
							<!--end 编辑课程基本信息-->

						</div>


					</div>
				</div>
		<!--end内容区域-->
<script src="/static/public/layer/load_layui.js"></script>			
<script>
	$(function() {

		layui.use(['form','layedit','jquery'], function() {
			var form = layui.form();
			var $ = layui.jquery;
			// layedit.build('detail'); //建立编辑器
			//监听提交
			form.on('submit(formDemo)', function(data) {
				layer.msg(JSON.stringify(data.field));
				return false;
			});
			form.on('select(cate_id)', function(data){
				var ii = layer.load();
				var id = data.value;
				$("#course_id").html('<option value="">请选择科目</option>');
				form.render('select');
			    $.ajax({
					type: "POST",
					url: "/course/get_cate_subject",
					data: {id:id},
					dataType: "json",
					success: function (data) {
						var ddl = $("#subject");
						var html ='<option value="">请选择科目</option>';
						$(data).each(function (key) {
							html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
						});
						$("#subject").html(html);
						form.render('select');
						layer.close(ii);
					}
				});
			});  
		});

		
	})
	function sel_video(obj) {
		var index = $(obj).parent().index(".add_video");
		layer.open({
			type: 2,
			area: ['730px', '530px'],
			fixed: false, //不固定
			maxmin: true,
			content: '/course/select_video/0/0/0/0/0/' + index
		});
	}
</script>

<script type="text/javascript" src="/static/public/webupload/webuploader.js"></script>
<script type="text/javascript" src="/static/public/webupload/upload.js"></script>
<script src="/static/manage/js/common.js"></script>

   	</body>
</html>
</body>

</html>
